package com.lsh.oms.core.enums;

/**
 * Created by miaozhuang on 18/2/28.
 */
public enum PoOrderDetailStatus {
	ORDER_NEW("新建", 0),
	ORDER_DEAL_SUCCESS("处理成功",10),
	ORDER_DEAL_FAIL("处理失败",15),
	ORDER_FINISH("已完成",20);

	private final int index;
	private final String name;

	private PoOrderDetailStatus(String name, int index) {
		this.name = name;
		this.index = index;
	}

	public static String getName(int index) {
		for (PoOrderDetailStatus c : PoOrderDetailStatus.values()) {
			if (c.getIndex() == index) {
				return c.name;
			}
		}
		return null;
	}

	public static PoOrderDetailStatus indexOf(int index) {
		for (PoOrderDetailStatus item : PoOrderDetailStatus.values()) {
			if (item.getIndex() == index) {
				return item;
			}
		}
		return null;
	}

	public int getIndex() {
		return index;
	}

	public String getName() {
		return name;
	}
}
